package day_14;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class ques1 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int year=scan.nextInt();
        int month=scan.nextInt();
        int day=scan.nextInt();

        System.out.println(Ydays(year,month,day));
    }

    public static int Ydays(int year,int month,int day){
        //Map<Integer,Integer> map=new hashMap<>();
        Map<Integer,Integer> map=new HashMap<>();
        map.put(1,31);
        map.put(3,31);
        map.put(5,31);
        map.put(7,31);
        map.put(8,31);
        map.put(10,31);
        map.put(12,31);

        map.put(4,30);
        map.put(6,30);
        map.put(9,30);
        map.put(11,30);

        map.put(2,28);
        int days=0;
        if(year%4==0&&year%100!=0){
            for(int i=1;i<month;i++){
                if(i==2){
                    days+=map.get(i)+1;
                    continue;
                }
                days+=map.get(i);
            }
            return days+day;
        }else{
            for(int i=1;i<month;i++){

                days+=map.get(i);
            }
            return days+day;
        }
    }
}
